#coding:utf-8
import re
data = """
GET http://www.json.cn/ HTTP/1.1
Host: www.json.cn
Proxy-Connection: keep-alive
Accept: text/html,application/xhtml+xml,applicat
.8
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64)
Gecko) Chrome/44.0.2403.155 Safari/537.36
Accept-Encoding: gzip, deflate, sdch
Accept-Language: zh-CN,zh;q=0.8
Cookie: Hm_lvt_2ea5d7a3a13a1da3236117fd8ee2b071=
,1519712318
If-None-Match: W/"59a69175-2798"
If-Modified-Since: Wed, 30 Aug 2017 10:20:37 GMT"""
host = re.search(r"Host:\s(.*?)\s", data)
# print host.group()#Host: www.json.cn
print host.group(0)#Host: www.json.cn
print host.group(1)#www.json.cn